import { reportDataApi } from "@/api/data";
import type { ReportDataModel } from "@/api/data/model";
import { defineStore } from "pinia";

//定义一个接口,用来对state中进行类型限制
interface DataStoreType {
  reportData: ReportDataModel;
}
const useDataState = defineStore("data", {
  state: (): DataStoreType => {
    return {
      reportData: {},
    };
  },
  actions: {
    async getData() {
      const result = await reportDataApi();
      this.reportData = result;
    },
  },
  getters: {},
});

export default useDataState;
